﻿//
//  Windows_libc
//
//  Created by  cc_team(陈旭，陈曦) qq:511272827.
//  Copyright 2011 cc_team. All rights reserved.
//
#ifndef CC_CTYPE_H
#define CC_CTYPE_H

#define IS_SLASH(ch)	((ch) == '\\' || (ch) == '/')

// convert the upper case to lower case or the lower case to upper case
#define TO_LOWER(c)		((c) + 'a' - 'A')
#define TO_UPPER(c)		((c) + 'A' - 'a')

// types of char
#define LOWER_TYPE		(1 << 0)
#define UPPER_TYPE		(1 << 1)
#define DIGIT_TYPE		(1 << 2)
#define SPACE_TYPE		(1 << 3)
#define PUNCT_TYPE		(1 << 4)
#define CONTROL_TYPE	(1 << 5)
#define BLANK_TYPE		(1 << 6)
#define HEX_TYPE		(1 << 7)

#define ALPHA_TYPE		(LOWER_TYPE | UPPER_TYPE)
#define XDIGIT_TYPE		(DIGIT_TYPE | HEX_TYPE)
#define ALPHA_NUM_TYPE	(ALPHA_TYPE | DIGIT_TYPE)

#ifdef __cplusplus
extern "C" {
#endif

int cc_isalpha(int ch);	
int cc_isspace(int ch);	// tab, space, '\r', '\n', '\f',  '\v'
int cc_isblank(int ch);	// not the standard C: the tab or space char
int cc_isdigit(int ch);	
int cc_isxdigit(int ch);
int cc_isalnum(int ch);
int cc_isupper(int ch);
int cc_islower(int ch);
int cc_isascii(int ch);
int cc_ispunct(int ch);
int cc_isprint(int ch);
int cc_isgraph(int ch);

int cc_toascii(int ch);
int cc_toupper(int ch);
int cc_tolower(int ch);


#ifdef __cplusplus
}
#endif

#endif